home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 4 #4
/
Commodore_Disk_User_Vol.4_4_1991_-.d64
/
ge.mc utils demo
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
6KB
|
199 lines
10 x=x+1
20 if x=2 then load"ge.sprites",8,1
30 if x=3 then load"ge.mc utils",8,1
100 gosub10000
110 print"[147][144]-[213]tilities [196]emo-"
120 print" [183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183]"
130 print" [212]his is a short [196]emo to show and"
140 print" explain the different routines."
150 print" [212]o use the [213]tilities, first:"
160 print"[204][207][193][196]"q$"[199][197].[205][195] [213][212][201][204][211]"q$",8,1"
170 print"[212]hen define the following variables within [194][193][211][201][195]:"
180 print" [193][212]=49152 : [211][201]=49155 : [211][197]=49158"
190 print" [198][216]=49161 : [208][213]=49164 : [195][211]=49167"
200 print" [210][214]=49170 : [211][195]=49173"
210 print" [212]his allows you to use [211][217][211] [198][216],1"
220 print" rather than [211][217][211][160]49161,1 which is"
230 print" slower and more difficult to"
240 print" understand."
250 gosub 5000
300 print"[147][208]rint at"
310 print" [183][183][183][183][183][183][183][183]"
320 print" [212]his routine allows you to print"
330 print" anywhere on the screen without using"
340 print" awkward cursor controls."
350 print"[211][217][211] [193][212],[216],[217],string"
360 print" e.g [211][217][211][160][193][212],1,1,"q$"[200]ello!"q$
370 print" [211][217][211][160][193][212],0,1,a$"
380 print" [211][217][211] [193][212],2,2,b$+"q$"[200]i!"q$
390 print"[216]: 0-39 , [217]: 0-24"
400 gosub 5000
410 for a=1 to 15:poke646,rnd(1)*16:sys at,rnd(1)*34,rnd(1)*5+18,"[200]ello!!"
420 for b=1 to 50:next
430 next
440 gosub 5000
500 print"[144][147][211]prite [208]ulse"
510 print" [183][183][183][183][183][183][183][183][183][183][183][183]"
520 print" [212]his routine turns on [211]prite 1"
530 print" and sets up an interrupt at $0314 ([201][210][209])"
540 print" [212]his makes the sprite pulse:"
550 print"[211][217][211] [211][201],[211]peed (1-255)"
560 gosub 5000
570 sys si,5:poke 53249,175
580 for a=1 to 3:for b=60 to 255
590 poke 53248,b:next b,a
600 poke 53248,174
610 sys at,1,10,"[212]he sprite can be made to flash"
620 print" by [208][207][203]ing 251,1: "
630 gosub 5000:poke 251,1
640 sys at,1,13,"[212]o stop this:"
650 print"[208][207][203][197] 251,0":gosub 5000
660 poke 251,0
670 gosub 5000
700 print"[147][211]elect"
710 print" [183][183][183][183][183][183]"
720 print" [212]his makes the sprite flash for a"
730 print" short time depending on '[211]peed'. [201]t"
740 print" does this by [208][207][203]ing 251,1 for a time"
750 print" then reseting it to 0."
760 print"[212]he routine also change the sprite"
770 print" pointer in 2040 from 13 to 15 ([197][207][210] #2)"
780 print" and back again:"
790 print"[211][217][211] [211][197],[211]peed (1-255)"
800 gosub 5000:sys se,60
810 gosub 5000:sys se,60
820 gosub 5000
830 poke 53269,0:poke 54296,15
900 print"[147][211]ound [198][216]"
910 print"[183][183][183][183][183][183][183][183]"
920 print" [212]hese routines make a few simple"
930 print" sounds which can be incorporated into"
940 print" a [194][193][211][201][195][160]game.
950 [153]"(NULL)emember to turn on the volume:"
960 [153]" (NULL)(NULL)(NULL)val 54296,1-15"
970 [153]"(NULL)(NULL)(NULL) asc(NULL),(NULL)ound (0-3)"
980 [153]"(NULL)ounds: 0 'ding'"
990 [153]" 1 'barp'"
1000 [153]" 2 launch a bullet/missile etc."
1010 [153]" 3 explosion"
1020 [153]"((NULL)(NULL)(NULL)val 54276,128 is needed to finish 2)"
1030 [129] x[178]0 [164] 3:[141] 5000
1040 [158] fx,x:[139] x[179][177] 2 [167] 1060
1050 [129] a[178]1 [164] 1000:[130]:[151] 54276,128
1060 [130]
1070 [141] 5000
1100 [153]"load(NULL)ulse and lenhase (NULL)ights"
1110 [153]" usrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusr"
1120 [153]" (NULL)hese two routines allow text to be"
1130 [153]" pulsed."
1140 [153]"(NULL)(NULL)(NULL) (NULL)(NULL) or len(NULL),(NULL),(NULL),(NULL)ength (1-250),asclag"
1150 [153]"right$f asclag is 1-255, the line atnpeek(NULL)(NULL)val will"
1160 [153]" be pulsed too:"
1170 x[178]0:[141] 5000
1180 [158] rv,1,1,22
1190 rt[178]pu:p[178]30:[141] 4000
1200 [158] at,1,13,"(NULL)he syntax for lenhase (NULL)ights is the"
1210 [153]" same, but the effect is this:"
1220 [141] 5000
1230 rt[178]cs:p[178]20:[141] 4000
1240 [141] 5000
1300 [153]"load(NULL)everse"
1310 [153]" usrusrusrusrusrusrusr"
1320 [153]" (NULL)his routine reverses characters on"
1330 [153]" screen so they can be highlighted."
1340 [153]" (NULL)(NULL)(NULL) (NULL)(NULL),(NULL),(NULL),length"
1350 [141] 5000
1360 [143] sys rv,23,6,11
1370 [158] at,1,10,"(NULL)his could be used with the pulse"
1380 [153]" routine to produce a selection bar:"
1390 [129] a[178]1 [164] 5:[153]a;"cmd: option ";[199](a[170]96):[130]
1400 [153]" 6: ascinish ! (ascire to (NULL)elect)"
1410 [153]" ((NULL)ove joystick up and down)"
1420 li[178]13:[158] rv,1,li,11
1430 j[178][194](56320):[139] j[178]127 [167] 1430
1440 u[178]j[178]126:d[178]j[178]125
1450 [139] li[178]18 [175] j[178]111 [167] 1600
1460 [139] u[170]d[178]0 [167] 1430
1470 ol[178]li
1480 li[178]li[171]u[172](li[177]13)[170]d[172](li[179]18)
1490 [158] rv,1,ol,11
1500 [158] rv,1,li,11
1510 [158] pu,1,li,11,20,0
1520 [137] 1430
1600 [153]"load(NULL)croll"
1610 [153]" usrusrusrusrusrusr"
1620 [153]" (NULL)his is a useful and very eyecatching"
1630 [153]" routine to scroll messages. (NULL)o do this"
1640 [153]" put the message or text in a string:"
1650 [153]" (NULL)val$="q$"left$ello (NULL)here!"q$" then:"
1660 [153]" (NULL)(NULL)(NULL) (NULL)len,(NULL)val,(NULL),(NULL),(NULL)ength,(NULL)peed,asclag"
1670 [153]" atnfter the (NULL)(NULL)(NULL) (NULL)len, the routine expects"
1680 [153]" a one or two letter string name. str$on't"
1690 [153]" put the '$' sign!
1700 print" [201]f [198]lag is 0, the message will scroll"
1710 print" off the screen completely. [201]f it is"
1720 print" 1-255, the scrolling will stop when"
1730 print" the last character of the string is"
1740 print" printed."
1750 print" [212]o scroll part of an array"
1760 print" e.g. [218][218]$([216]), put [205][197]$=[218][218]$([216]) then the"
1770 print" [211][217][211] [211][195],[205][197],..."
1780 gosub 5000
1800 print"[147][211]croll"
1810 print" [183][183][183][183][183][183]"
1820 print" [196]uring the scrolling, pressing space"
1830 print" of the [198]ire [194]utton will speed up the"
1840 print" scrolling about 8 times. [208]ressing any"
1850 print" other key or joystick movement will"
1860 me$="[212]his is a demo of the scrolling message routine......[212]ry some other"
1870 me$=me$+" settings....."
1880 print" temporarily halt the message."
1890 sys at,1,16,"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
1900 sys at,1,17," "
1910 sys at,1,18,"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
1920 sys at,1,11,"[204]ength: (1-38)";:inputl
1930 if l<1 then l=1
1940 if l>38 then l=38
1950 input " [211]peed: (1-255)";s
1960 input " [198]lag: (0/1)";f
1970 x=(40-l)/2
1980 sys rv,x,17,l:sys pu,x,17,l,40,0
1990 print"";:sys sc,me,x,17,l,s,f
2000 print:input" [212]est [193]gain y[157][157][157]";k$
2010 if k$="y" then 1890
2100 print"[147][212]he [197]nd..."
2110 print" [183][183][183][183][183][183][183][183][183][183]"
2120 print" [206]ow you have seen the different"
2130 print" routines, you can use them in your own"
2140 print" programs to spice them up. [201]f you"
2150 print" don't understand exactly how to use"
2160 print" any routine, either run this program"
2170 print" again, or [204][201][211][212] it and see how it does"
2180 print" the routine."
2190 print" [198]or yet more information on these"
2200 print" routines and the other ones used in"
2210 print" [199]alactic [197]ncounter, [204][207][193][196]"q$"[199].*"q$",8,1"
2220 print" and select [197]xtra [201]nfo."
2230 print"[212]ry spotting where these routines are"
2240 print" used in [199]alactic [197]ncounter!"
2250 print"[199][207][207][196] [204][213][195][203]!!"
2260 input " [196]o you want to run this again n[157][157][157]";k$
2270 if left$(k$,1)="y" then 110
2280 print"[147][194]ye!!":sys fx,0
2290 sys pu,1,1,5,20,0:goto 2290
4000 for y=1 to 8
4010 sys rt,1,2,22,p,1
4020 next:return
5000 sys at,13,24,"[144][208]ress a [203]ey...";
5010 poke 198,0
5020 get k$:if k$="" then 5020
5030 sys at,13,24,"[146] ";
5040 return
10000 at=49152
10010 si=at+3:se=si+3:fx=se+3:pu=fx+3
10020 cs=pu+3:rv=cs+3:sc=rv+3
10030 q$=chr$(34)
10040 for a=0 to 191:poke 832+a,peek(29504+a):next
10050 poke 53280,0:poke 53281,15
10060 return